package la.iok.hzsvn.lewin.movie.operation.controller;

import la.iok.hzsvn.lewin.movie.core.Token;
import la.iok.hzsvn.lewin.movie.operation.model.BalanceTotal;
import la.iok.hzsvn.lewin.movie.operation.service.BalanceService;
import la.iok.hzsvn.share.response.SingleDataResponse;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("balances")
public class BalanceController {
    private final BalanceService balanceService;

    public BalanceController(BalanceService balanceService) {
        this.balanceService = balanceService;
    }

    @GetMapping("total")
    public SingleDataResponse<BalanceTotal> total(@RequestHeader Token token){
        return new SingleDataResponse<>(balanceService.total(token));
    }
}
